package zhcms.admin;


import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;

import zhcms.db.DBManager;
import zhcms.db.DbConn;
import zhcms.db.ConnectionPool.PooledConnection;

public class GySystemMenu {
	
	public GySystemMenu()
	{
		
	}
	
	public int getMeneClassCount(){
		ResultSet rs = null;
		PooledConnection conn = null;
		String sql="select count(*) as id from gyhy_SywtemMuneClass";
		int countSywtemMuneClass=0;
		try {
			conn = DBManager.getConnection();
			rs = conn.executeQuery(sql);
			if (rs.next())
			{
				countSywtemMuneClass=rs.getInt("id");
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		finally {
            conn.close();
		}
		return countSywtemMuneClass;
	}

	public ArrayList<HashMap<String, String>> getMenuClass()
	{
		String sql="select id,name from gyhy_SywtemMuneClass order by id asc ";
		return DbConn.executeQuery(sql);
	}
	
	public ArrayList<HashMap<String, String>> getMenuBoard()
	{
		String sql="select id,name from gyhy_SywtemMuneBoard order by id asc ";
		return DbConn.executeQuery(sql);
	}
	
	public ArrayList<HashMap<String, String>> getMenuBoard(int classid)
	{
		String sql="select id,name,url from gyhy_SywtemMuneBoard where classid='"+classid+"' order by id asc ";
		return DbConn.executeQuery(sql);
	}
	
	
}
